package com.xbongbong.paas.constant;


import com.xbongbong.paas.enums.FieldTypeEnum;

import java.util.Arrays;
import java.util.List;

/**
 * 用于存放不分类的PAAS项目相关的常量
 *
 * @author kaka
 * @time 2018-8-8 16:19
 */
public class PaasConstant {

    /**
     * 公司名(即全公司)对应的部门id，与钉钉一直为1
     */
    public static final long CORP_DEPARTMENT_ID = 1L;

    /**
     * 存放默认数据的corpid = "0"
     */
    public static final String DEFAULT_DATA_CORPID = "0";

    /**
     * 系统操作的userId
     */
    public static final String SYS_USER_ID = "-1";


    /**
     * 外链操作的userId
     */
    public static final String OUT_LINK_USER_ID = "";

    /**
     * 外链操作的userId,外部传参是"-3"
     */
    public static final String OUT_LINK_USER_ID_PARAM = "-3";

    public static final String OUT_LINK_USER_NAME = "外部人员";



    /**
     * 所有的非用户操作，都称作 系统操作
     */
    public static final String SYS_OPERATING = "constant.paas.sys_operating";
    /**
     * 系统生成的数据：智能助手服务，脚本接口
     */
    public static final String SYS_GENERATED = "constant.paas.sys_generated";

    /**
     * hashmap初始化大小 // aka 16
     */
    public static final int DEFAULT_INITIAL_CAPACITY = 1 << 4;

    /**
     * 本地前端调试标记
     */
    public static final String FRONT_DEV_FLAG = "1";

    /**
     * 局域网ip前缀
     */
    public static final String LAN_IP_PREFIX = "192.168.";

    /**
     * 本地自回环ipv4地址
     */
    public static final String LOCAL_HOST_IPV4 = "127.0.0.1";

    /**
     * 本地自回环ipv6地址
     */
    public static final String LOCAL_HOST_IPV6 = "0:0:0:0:0:0:0:1";

    /**
     * 每天最多能执行的同步组织架构次数
     */
    public static final int MAX_DEPARTMENT_REFRESH_TIMES_PER_DAY = 10;

    /**
     * response返回的contentType类型
     */
    public static final String RESPONSE_CONTENT_TYPE = "application/json;charset=UTF-8";

    /**
     * user 存 roleIds记录的分隔符
     */
    public static final String ROLE_DELIMITER = "|";

    /**
     * role 中保存的permissions权限记录的分隔符
     */
    public static final String PERMISSION_DELIMITER = "|";

    /**
     * 一个公司自定义角色数上限，目前是50
     */
    public static final int ROLE_NUM_LIMIT = 50;

    /**
     * url地址权限类型，1表示是管理员能够访问的功能或链接
     */
    public static final int URL_PERMISSION_TYPE_ADMIN = 1;

    /**
     * url地址权限类型，2表示是普通链接或功能所有人都直接检查具体权限,SAAS
     */
    public static final int URL_PERMISSION_TYPE_SAAS = 2;

    /**
     * url地址权限类型，2表示是普通链接或功能所有人都直接检查具体权限,PAAS
     */
    public static final int URL_PERMISSION_TYPE_PAAS = 3;

    /**
     * 每个用户最多具有的角色数
     */
    public static final int USER_ROLE_MAX_SIZE = 10;

    /**
     * 待我审批的文案，显示在流程日志和流程列表中
     */
    public static final String WAITING_FOR_ME_TO_APPROVE = "constant.paas.waiting_for_me_to_approve";

    /**
     * 新建表单数据后提示信息（非流程表单）
     */
    public static final String FORM_ADD_RETURN_MSG = "constant.paas.form_add_return_msg";
    public static final Integer FORM_ADD_RETURN_CODE = 1;

    /**
     * 新建表单数据后提示信息（流程表单）
     */
    public static final String FORM_ADD_PROCESS_RETURN_MSG = "constant.paas.form_add_process_return_msg";
    public static final Integer FORM_ADD_PROCESS_RETURN_CODE = 2;

    /**
     * 我发起流程的文案，显示在流程日志中
     */
    public static final String INITIATE_AN_APPLICATION = "constant.paas.initiate_an_application";

    public static final String REVOKE_PROCESS = "constant.paas.revoke_process";

    /**
     * 地址省份前缀，用于前端的地址分解
     */
    public static final String PROVINCE = "province";
    /**
     * 地址城市前缀，用于前端的地址分解
     */
    public static final String CITY = "city";
    /**
     * 地址区/县前缀，用于前端的地址分解
     */
    public static final String DISTRICT = "district";
    /**
     * 地址详细地址前缀，用于前端的地址分解
     */
    public static final String ADDRESS = "address";

    /**
     * 单个公司最大的应用数量
     */
    public static final int APP_MAX_LENGTH = 90;

    /**
     * 单个公司表单最大的数量
     */
    public static final int FORM_MAX_LENGTH = 90;

    /**
     * 地址的key值
     */
    public static final int ADDRESS_KEN_LENGTH = 4;
    /**
     * 定位的key值
     */
    public static final int LOCATION_KEN_LENGTH = 5;



    /**
     * 经度最大值
     */
    public static final double LONGITUDE_MAX = 180D;
    /**
     * 经度最大值
     */
    public static final double LONGITUDE_MIN = -180D;
    /**
     * 纬度最大值
     */
    public static final double LATITUDE_MAX = 90D;
    /**
     * 纬度最小值
     */
    public static final double LATITUDE_MIN = -90D;
    /**
     * 首页左侧菜单
     */
    public static final String LEFT_POSITION = "left";
    /**
     * 首页顶部中心菜单
     */
    public static final String TOP_CENTER_POSITION = "topCenter";
    /**
     * 首页顶部右侧
     */
    public static final String TOP_RIGHT_POSITION = "topRight";
    /**
     * 首页
     */
    public static final String HOME_STRING = "home";
    /**
     * ES查询10000条
     */
    public static final Integer ES_MAX_PAGE_SIZE = 10000;
    /**
     * 左括号
     */
    public static final String LEFT_BRACKET = "（";
    /**
     * 右括号
     */
    public static final String RIGHT_BRACKET = "）";
    /**
     * 冒号
     */
    public static final String COLON = "：";

    public static final String COMMAS = ",";

    /**
     * 金额明细
     */
    public static final String AMOUNTDETAIL = "amountDetail";

    /*
     * 3个月
     */
    public static final Integer COUNT_MONTH_THREE = 3;

    /**
     * 6个月
     */
    public static final Integer COUNT_MONTH_SIX = 6;
    /**
     * 默认精度
     */
    public static final Integer DEFAULT_ACCURACY = 4;

    /**
     * 退货退款ID
     */
    public static final String REFUND_ID = "refundId";

    /**
     * 跟我们API系统交互的SECRET
     */
    public static final String API_SECRET = "123";

    /**
     * 采购退货ID
     */
    public static final String RETURNED_PURCHASE_ID = "returnedPurchaseId";

    public static final String CHINESE_SEMICOLON = ";";

    /**
     * 关联数据子表单外和子表单内总数不超过12个
     */
    public static final Integer LINK_DATA_NUM = 12;

    /**
     * 关联数据多选子表单外和子表单内总数不超过10个
     */
    public static final Integer LINK_DATA_MULTI_NUM = 10;

    /**
     * 智能助手标准版数量
     */
    public static final Integer AIASSISTANT_PROFESSIONAL_ALL_USER_NUM = 5;

    /**
     * 智能助手高级版数量
     */
    public static final Integer AIASSISTANT_PROFESSIONAL_USED_USER_NUM = 15;
    /**
     * 智能助手旗舰版数量
     */
    public static final Integer AIASSISTANT_ULTIMATE_NUM = 30;
    /**
     * 业务规则可更新最大条数
     */
    public static final Integer LIMIT_MAX_NUM = 50;
    /**
     * 业务规则检索条数
     */
    public static final Integer PAGE_NUM = 51;
    /**
     * 低代码配置最大条数
     */
    public static final Integer LOW_CODE_CONFIG_NUM = 5;
    /**
     * 单条表单数据中，子表单的数据量
     */
    public static final Integer SUB_DATA_PAGE_NUM = 1600;

    /**
     * 子表单最大的长度
     */
    public static final Integer SUB_FORM_MAX_LARGE = 200;
    /**
     * 关联产品最大行数
     */
    public static final Integer SELECT_PRODUCT_MAX_ROW_LARGE = 260;
    /**
     * 关联数据多选上限
     */
    public static final Integer LINK_DATA_MULTI_MAX_SIZE = 10;

    /**
     * 子表单
     */
    public static final Integer BUSINESS_RULE_SUB_FORM_MAX_LARGE = 100;

    public static final String CODE = "code";

    public static final String MSG = "msg";

    public static final String WORK_ORDER_MANAGEMENT ="constant.paas.work_order_management";

    public static final String PRODUCT_MANAGEMENT ="constant.paas.product_management";

    public static final String PRINTSTRING ="print";

    public static final String PRINT ="constant.paas.print";

    public static final String CLOUD_CODE_ALIAS ="cloudCode";
    /**
     * 标签每个分组下最大的标签数
     */
    public static final Integer LIMIT_MAX_NUM_LABEL = 50;
    /**
     * 系统标签最大数
     */
    public static final Integer LIMIT_MAX_NUM_SYSTEM_LABEL = 200;

    /**
     * 标签每个分组下最大的标签数
     */
    public static final Integer LIMIT_MAX_NUM_DATA_LABEL = 20;
    /**
     * es常用的page
     */
    public static final Integer ES_COMMON_PAGE = 1;

    public static final Double couponRatio = 60d;

    /**
     * 关联列表最大限制，（如果此处最大数变动的话，前端需要改动，且EnableAssociationListDTO.associationList也需要改动）
     */
    public static final Integer ASSOCIATION_LIST_MAX_SIZE = 20;


    public static final Integer DEVELOPER_MAX_SIZE = 10;


    public static final String DEFAULT_LABEL_GROUP = "constant.paas.label_group_name";

    public static final String DEFAULT_LABEL_NAME = "constant.paas.label_name";

    public static final String DEFAULT_LABEL_COLOR = "#FF813D";

    public static final Integer SERVICE_MAX_SIZE = 10;

    public static final String LOW_CODE = "lowCode";

    public static final String LOW_CODE_ACTION_SETTING = "constant.low_code_action_setting";
    public static final String CUSTOM_BUTTON_ACTION = "constant.custom_button_action";
    public static final String PAAS_FORM_SERVICE = "constant.paas_form_service";
    public static final String CUSTOMER_RE_SOLD_RATE ="constant.paas.statistic.customer_re_sold_rate";

    public static final String CUSTOMER_RECHURN_RATE ="constant.paas.statistic.customer_rechurn_rate";

    public static final List<String> NOT_IN_DATA_ATTR_LIST = Arrays.asList(FieldTypeEnum.SERIALNO.getAlias(), FieldTypeEnum.DEPARTMENTID.getAlias());
    /**
     * es返回数据超出 1.7976931348623157E+103088 返回 Infinity 小于 -1.7976931348623157E+103088 返回-Infinity
     **/
    public static final String ES_INFINITY = "Infinity";

    public static final String ENABLE = "constant.i18nString.enable";

    public static final String CLOSED= "constant.i18nString.closed";

    /**
     * 顿号
     */
    public static final String COMMA = "、";

    public static Integer DEFUALT_NUMBER_DIGIT = 3;

    /**
     *  数据预警，每个图表最大可创建预警的数目
     */
    public static final int DATA_WARNING_MAX_CREATE_NUM = 3;

    /**
     *  数据预警，每个图表最大可开启预警的数目
     */
    public static final int DATA_WARNING_MAX_ENABLE_NUM = 3;

    /**
     *  数据预警，每个图表每个预警最多可以展示历史的数目
     */
    public static final int DATA_WARNING_HISTORY_MAX_NUM = 3;
    /**
     * 计数
     */
    public static final String COUNT = "count";
    /**
     * 高级版 - 数据预警可执行次数
     */
    public static final int ADVANCED_NUMBER_EXECUTIONS = 300;
    /**
     * pro旗舰版 - 数据预警可执行次数
     */
    public static final int ULTIMATE_NUMBER_EXECUTIONS = 3000;

    public static final String MSG_CONTENT = "content";

    public static final int RANGE_SIZE = 2;

    public static final String DEFAULT_SIMPLING_RANGE_START = "8:00";

    public static final String DEFAULT_SIMPLING_RANGE_END = "20:00";

    public static final int DEFAULT_STRATEGY_TYPE = 1;

    public static final String DEFAULT_STRATEGY_TIME = "8:00";

    public static final String ENABLE_DATA_WARNING = "开启";

    public static final String CLOSE = "关闭";

    public static  final String LEFT = "left";

    public static final String RIGHT = "right";

    public static  final int LEFT_SIDE_FLAG = 0;

    public static final int RIGHT_SIDE_FLAG = 1;

    public static final String DATA_ID_MEMO = "constant.i18nString.data_id_memo";

    public static final String WORK_ORDER = "workOrder_";

    public static final String RIGHT_BRACE = "{";

    public static final String LEFT_BRACE = "}";

    public static final int DATE_PARAM_NUM = 2;

    public static final int ES_SCRPIT_LENGTH = 20180;

    public static final int HOME_PAGE_SIZE = 50;

    public static final int SHOW = 1;

    public static final int NONE_SHOW = 0;

    public static final int ENABLE_FORBIDDEN = 1;

    public static final int DISABLE_FORBIDDEN = 0;

    public static final int ENABLE_HIDDEN = 1;

    public static final int DISABLE_HIDDEN = 0;

    /**
     * 首页审批pageSize
     */
    public static final int APPROVAL_INDEX_SIZE = 5;
    /**
     *  自定义的目标最大数量
     */
    public static final int CUSTOM_PERFORMANCE_MAX_NUM = 15;


    /**
     *  工作流节点最大数量
     */
    public static final int MAX_WORKFLOW_NODE_COUNT = 150;

    public static final String ALIAS = "alias";
    public static final String NAME = "name";
    public static final String ICON = "icon";
}
